package com.xiebishe.mylibrary.common.groupAdapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

/**
 * @author xxZhu
 * @class RecyclerWholeLineAdapter
 * @describe 占据整个一行的viewAdapter, 包括在瀑布流中
 */
public class RecyclerWholeLineAdapter extends RecyclerOneViewAdapter {

    public RecyclerWholeLineAdapter(@NonNull View view) {
        super(view);
    }

    @Override
    public void onViewAttachedToWindow(@NonNull OneViewHolder holder) {
        super.onViewAttachedToWindow(holder);
        ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
        if (lp instanceof StaggeredGridLayoutManager.LayoutParams) {
            StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
            p.setFullSpan(true);
        }
    }
}
